/**********************************************************
 * File description:ProcedureService.h
 * Function:扩增程序服务类
 * Current Version: 1.0.0
 * Author: 夏新宇
 * Date: 2022-10-02
 *  -----
 *  Copyright by bokun Software.
 **********************************************************/
#ifndef PROCEDURESERVICE_H
#define PROCEDURESERVICE_H

#include <iostream>
#include <QCoreApplication>
#include <QDebug>
#include "SqliteDriver.h"
#include "QPCRDB.h"
#include "QPCR.h"
#include "Constant.h"
#include "Convertion.h"
#include "XmlParser.h"
#include "ConfigFileservice.h"

class ProcedureService
{
public:
    ProcedureService();
    ~ProcedureService();
    int getRunTime(QString experimentId); //获得扩增程序的运行时间
    QList<QString> getProcedureByType(QString experimentId,QString experimentType); //根据实验类型生成系统默认的扩增程序
    QString insertStage(QString experimentId,QString stageName,QString stageOrder,QString cycleNumber,QList<QHash<QString,QString>> stepList); //插入阶段
    QString insertStage(QString experimentId,QString stageName,QString stageOrder); //插入阶段
    void deleteStage(QString experimentId,QString stageId,QString stageOrder); //删除阶段
    void insertStep(ProcedureStep step); //插入步骤
    void deleteStep(QString stageId,QString stepOrder); //删除步骤
    void insertCycle(QString stageId,QString cycleNumber); //修改循环
    void openFluorescence(QString stageId,QString stepOrder,bool isOpen); //开启荧光收集
    void updateDuration(QString stageId,QString stepOrder,QString duration); //修改步骤运行时间
    void updateTemperature(QString stageId,QString stepOrder,QString temperature); //修改步骤默认温度
    void updateRate(QString stageId,QString stageOrder,QString rate); //修改步骤升温速率
    void restoreDefaultState(QString experimentId,QString experimentType); //将扩增程序还原到默认状态
    void deleteProcedureData(QString experimentId); //删除指定实验的扩增程序数据
    QHash<QHash<QString,QString>,QList<QHash<QString,QString>>> getProcedureData(QString experimentId); //获取实验的扩增程序数据
    QList<float> getStepTimeAndTemperatureByRecieve(QString experimentId,QString jieduan,QString bianhao,QString buzhou); //通过温度回传数据获取指定步骤时间和温度
    

private:
    QString path;
    SqliteDriver * sqlD;
    Simplexml * simplexml;
    Convertion * conv;
    ConfigFileService * cfs;
};

#endif // PROCEDURESERVICE_H
